package com.example.myapplication.fragment

import android.content.Intent
import com.bumptech.glide.Glide
import com.bumptech.glide.load.MultiTransformation
import com.bumptech.glide.load.resource.bitmap.CenterCrop
import com.bumptech.glide.load.resource.bitmap.RoundedCorners
import com.bumptech.glide.request.RequestOptions
import com.example.myapplication.DatabasePageActivity
import com.example.myapplication.MainActivity2
import com.example.myapplication.PopularScienceActivity
import com.example.myapplication.PopularScienceMineActivity
import com.example.myapplication.fragment.BaseFragment
import com.example.total.R
import com.example.total.databinding.HomeFragmentLayoutBinding

class HomeFragment: BaseFragment<HomeFragmentLayoutBinding>() {
    override fun initData() {

        Glide.with(this)
            .setDefaultRequestOptions(
                RequestOptions()
                    .transform(MultiTransformation(CenterCrop(), RoundedCorners(30))))
            .load(R.mipmap.home_image1)
            .into(binding.topImage)

        Glide.with(this)
            .setDefaultRequestOptions(
                RequestOptions()
                    .transform(MultiTransformation(CenterCrop(), RoundedCorners(30))))
            .load(R.mipmap.home_image2)
            .into(binding.topImage2)
        binding.topImage.setOnClickListener {
            Intent().apply {
                setClass(requireActivity(), PopularScienceActivity::class.java)
                startActivity(this)
            }
        }
        binding.shujuku.setOnClickListener {
            Intent().apply {
                setClass(requireActivity(),DatabasePageActivity::class.java)
                startActivity(this)
            }
        }
        binding.topImage2.setOnClickListener {
            Intent().apply {
                setClass(requireActivity(), MainActivity2::class.java)
                startActivity(this)
            }
        }
    }
}